<!-- DOCTYPE HTML -->
<?php

date_default_timezone_set('Europe/Copenhagen');

//include the files from the PHP FT client library
include('fusion-tables-client-php/clientlogin.php');
include('fusion-tables-client-php/sql.php');
include('fusion-tables-client-php/file.php');

// Table id
$tableid = 2200813;

//Enter your username and password
$username = "telenordev@gmail.com";
$password = "qwertyasdfg";

// Get auth token - it would be better to save the token in a secure database
// rather than requesting it with every page load.
$token = ClientLogin::getAuthToken($username, $password);
$ftclient = new FTClientLogin($token);

// If the request is a post, insert the data into the table
if($_SERVER['REQUEST_METHOD'] == 'POST') {
  // Insert form data into table
  $insertresults = $ftclient->query(SQLBuilder::insert($tableid, 
    array('phoneNumber'=> $_POST['phonenr'],
    'type' => $_POST['type'],
    'location' => $_POST['lattitude'].','.$_POST['longitude'],
    'timestamp' => time(),
	'time' => $_POST['time'])));
  $insertresults = explode("\n", $insertresults);
  $rowid1 = $insertresults[1];
}
?>
<html>
 <head>
 <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
  <title>Telenor Network Reporter</title>
  <link rel="stylesheet" href="style.css"/>

  <link rel="icon" href="favicon.ico" />

 </head>
 <body>
 <h1>Telenor Network Reporter</h1>
  
<p>Thank you!</p>

<a href="index_geo.html">Show map</a>
 </body>
</html>
